package com.my.study.juc;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author: yidujun
 * @create: 2021/08/19 20:06
 */
public class Test {

    private ExecutorService service = Executors.newFixedThreadPool(1);

    @org.junit.Test
    public void test01() {
        System.out.println(Thread.currentThread().getName() + "开始...");
        try {
            service.submit(() -> wiii()).get();
            System.out.println(Thread.currentThread().getName() + "结束...");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private void wiii() {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"ccc");
    }

}
